﻿<div id="wrap">
    <div data-ng-include src="'views/shared/_nav.html'"></div>
    <div data-ng-include src="'views/shared/_navcustom.html'"></div>
    <div class="container admin-views-main admin-views-custom-index" data-ng-controller="CustomController">
        <div id="modal-theme-edit" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
                        <h4 class="modal-title">{{package.Title}}</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-horizontal clearfix">
                            <div class="pkg-common">
                                <div class="row">
                                    <div class="col-md-4">
                                        <img ng-if="!package.PackageUrl" class="pkg-img" width="100" src="{{package.IconUrl}}" alt="Package image" title="" />
                                        <a ng-if="package.PackageUrl" href="{{package.PackageUrl}}" target="_new">
                                            <img class="pkg-img" width="100" src="{{package.IconUrl}}" alt="Package image" title="" />
                                        </a>
                                    </div>
                                    <div class="col-md-8">
                                        <div>
                                            <span>{{lbl.description}}: </span>
                                            <span ng-bind-html="package.Description"></span>
                                        </div>
                                        <hr />
                                        <div>
                                            <span><i class="fa fa-user"></i> {{lbl.author}}: </span>
                                            <span ng-bind-html="package.Authors"></span>
                                        </div>
                                        <div ng-if="package.Tags">
                                            <span><i class="fa fa-tags"></i> {{lbl.tags}}: </span>
                                            <span ng-bind-html="package.Tags"></span>
                                        </div>
                                        <div ng-if="package.LastUpdated">
                                            <span><i class="fa fa-calendar"></i> {{lbl.date}}: </span>
                                            <span ng-bind-html="package.LastUpdated"></span>
                                        </div>
                                        <div ng-if="package.DownloadCount">
                                            <span><i class="fa fa-download"></i> {{lbl.downloads}}: </span>
                                            <span>{{package.DownloadCount}}</span>
                                        </div>
                                    </div>
                                </div>
                                <div ng-if="canInstallPackages && pkgLocation != 'G'"  class="form-group">
                                    <div class="col-md-4">
                                        <span>{{lbl.priority}}</span>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" class="form-control" id="txtPriority" data-ng-model="package.Priority" />
                                    </div>
                                </div>
                                <div data-ng-if="pkgLocation != 'G' && canEditExensions" class="form-group">
                                    <div class="col-md-4">
                                        <span>{{lbl.enabled}}</span>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="checkbox" name="ckEnabled" data-ng-model="package.Enabled" />
                                    </div>
                                </div>
                            </div>
                            <div ng-if="package.SettingsUrl">
                                <iframe ng-if="canEditExensions" ng-src="{{extEditSrc}}" width="550" height="300" frameborder="0"></iframe>
                            </div>
                            <h4 data-ng-if="customFields.length > 0">Custom fields</h4>
                            <div data-ng-repeat="item in customFields" class="form-group">
                                <label class="control-label col-md-4" for="txtSlug">{{item.Key}}</label>
                                <div class="col-md-8">
                                    <input type="text" class="form-control" id="txtSlug" data-ng-model="item.Value" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button data-ng-if="pkgLocation != 'G'" data-ng-click="save()" class="btn btn-primary pull-right btn-tabkey"><i class="fa fa-save"></i>{{lbl.save}}</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-ban"></i>{{lbl.cancel}}</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="page-header clearfix">
            <h2 class="page-title pull-left">
                {{lbl.extensions}} <span id="spinner" class="loaded"><i class="fa fa-spinner fa-spin fa-sm"></i></span>
            </h2>
        </div>
        <div class="toolbar-grid clearfix">
            <div ng-if="IsPrimary" class="pull-left">
                <button data-ng-if="pkgLocation == 'G'" ng-click="processChecked('install')" class="btn btn-success btn-sm"><i class="fa fa-check"></i>{{lbl.install}}</button>
                <button data-ng-if="pkgLocation != 'G'" ng-click="processChecked('uninstall')" class="btn btn-danger btn-sm"><i class="fa fa-times"></i>{{lbl.doDelete}}</button>
            </div>
            <div class="pull-right btn-flt-r hmin767"><button class="btn btn-default btn-sm"><i class="fa fa-cog fa-lg"></i><span>{{lbl.filter}}</span></button></div>
            <div class="pull-right filterbar flt-r clearfix">
                <div class="active-flt-r"></div>
                <div class="navbar-left search-grid pull-right">
                    <input type="text" ng-model="query" ng-change="search()" class="input-sm form-control pull-right" placeholder="{{lbl.search}}" />
                </div>
                <div class="btn-toolbar pull-right">
                    <div class="btn-group">
                        <button id="fltr-loc" class="btn btn-default btn-sm active" data-ng-click="relocate('L')">{{lbl.installed}}</button>
                        <button id="fltr-gal" class="btn btn-default btn-sm" ng-if="canInstallPackages" data-ng-click="relocate('G')">{{lbl.gallery}}</button>
                    </div>
                </div>
                <span class="pull-right lbl-show">{{lbl.show}} :</span>
            </div>
        </div>
        <table class="table table-bordered table-striped table-hover table-responsive">
            <thead>
                <tr>
                    <th><input type="checkbox" id="chkAll" data-ng-click="checkAll($event)" /></th>
                    <th class="hmax768">&nbsp;</th>
                    <th class="table-item-title table-item-w70">{{lbl.title}} <a ng-click="sort_by('Title',$event)"><i class="fa fa-sort"></i></a></th>
                    <th class="hmax768">{{lbl.version}}</th>
                    <!-- if gallery add class to author list -->
                    <th data-ng-if="pkgLocation != 'G'" class="hmax768">{{lbl.author}}</th>
                    <th data-ng-if="pkgLocation != 'L'" class="hmax768 author-gallery">{{lbl.author}}</th>
                    <!--<th class="hmax359">{{lbl.lastUpdate}}</th>-->
                    <th data-ng-if="pkgLocation != 'G'">{{lbl.enabled}}</th>
                    <th class="hmax992" data-ng-if="pkgLocation != 'G'">{{lbl.priority}}</th>
                </tr>
            </thead>
            <tbody data-bind="foreach: items">
                <tr data-ng-repeat="item in pagedItems[currentPage] | orderBy:sortingOrder:reverse">
                    <td><input type="checkbox" id="{{item.Id}}" data-ng-model="item.IsChecked" ng-disabled="item.Location == 'L'" /></td>
                    <td class="table-item-avatar hmax768"><img src="{{item.IconUrl}}" /></td>
                    <td class="table-item-title">
                        <div class="text-ellipsis pull-left">
                            <a title="{{item.Title}}" href="" ng-click="loadCustomFields(item.Id)">{{item.Title}}</a>
                            <span class="item-description hmax480">{{item.Description}}</span>
                        </div>
                        <a data-ng-if="item.Location != 'L'" title="{{item.Title}}" class="external-link pull-right" target="_new" href="http://dnbegallery.org/cms/List/{{item.PackageType}}s/{{item.Id}}"><i class="fa fa-external-link"></i></a>
                    </td>
                    <td class="hmax768">{{item.Location == 'L' ? item.LocalVersion : item.OnlineVersion}}</td>
                    <!-- if gallery add class to author list -->
                    <td data-ng-if="pkgLocation != 'G'" class="hmax768" data-ng-bind-html="item.Authors"></td>
                    <td data-ng-if="pkgLocation != 'L'" class="hmax768 author-gallery" data-ng-bind-html="item.Authors"></td>
                    <!--<td class="hmax359">{{item.LastUpdated}}</td>-->
                    <td data-ng-if="item.Location != 'G'"><input type="checkbox" data-ng-model="item.Enabled" data-ng-disabled="true" /></td>
                    <td class="hmax992" data-ng-if="item.Location != 'G'">{{item.Priority}}</td>
                </tr>
            </tbody>
        </table>
        <div class="text-right pagination-wrapper">
            <ul class="pagination pagination-sm">
                <li data-ng-class="{disabled: currentPage == 0}">
                    <a data-ng-click="prevPage()">« {{lbl.prev}}</a>
                </li>
                <li data-ng-repeat="n in range(pagedItems.length)" data-ng-class="{active: n == currentPage}" data-ng-click="setPage()">
                    <a data-ng-bind="n + 1">1</a>
                </li>
                <li data-ng-class="{disabled: currentPage == pagedItems.length - 1}">
                    <a data-ng-click="nextPage()">{{lbl.next}} »</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div id="footer" data-ng-include src="'views/shared/_footer.html'"></div>
